package cn.community.system.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

// 活动报名记录
@Getter
@Setter
public class ActivityRecord {
    public static final int APPLYING = 0;   // 报名中
    public static final int APPLY_YES = 1;   // 报名成功
    public static final int APPLY_NO = 2;   // 报名失败

    private Long id;
    private String association;     // 社团名称
    private Long associationId;     // 社团id
    private String activityName;    // 活动名称
    private Long activityId;        // 活动id
    private String applicant;       // 报名者
    private Long applicantId;       // 报名者id
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;        // 创建时间
    private Double allTime;         // 活动总时长（单位：小时）

    private Integer status = APPLYING;     // 报名状态
    private String reason;  // 报名失败理由

    public String getJsonString(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("association",association);
        map.put("associationId",associationId);
        map.put("activityName",activityName);
        map.put("activityId",activityId);
        map.put("applicant",applicant);
        map.put("applicantId",applicantId);
        map.put("createTime",createTime);
        map.put("allTime",allTime);
        map.put("status",status);
        map.put("reason",reason);
        return JSON.toJSONString(map);
    }
}
